{extend name="public/base" /}
{block name="content"}
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
        {volist name="Think.config.global.CONFIG_GROUP_LIST" id="group" }
        <li {eq name="type" value="$key"} class="layui-this" {/eq}> <a href ="{:url('config/group',['type'=>$key])}">{$group}</a></li>
        {/volist}
    </ul>
</div>
<form method="post" class="layui-form layui-card" action="{:url()}" id="ConfigTable" onsubmit="return false">
    <div class="layui-card-body">
        {volist name="list" id="config"}
        <div class="layui-form-item">
            <label class="layui-form-label">{$config.title}</label>
            <div class="layui-input-block">
                {switch name="config.type"}
                {case value="0"}
                <input name="config[{$config.name}]" value="{$config.value}" placeholder="" class="layui-input" type=number">
                {/case}
                {case value="1"}
                <input name="config[{$config.name}]" value="{$config.value}" placeholder="" class="layui-input" type=text">
                {/case}
                {case value="2"}
                <textarea name="config[{$config.name}]" class="layui-textarea">{$config.value}</textarea>
                {/case}
                {case value="3"}
                <textarea name="config[{$config.name}]" class="layui-textarea">{$config.value}</textarea>
                {/case}
                {case value="4"}
                <select name="config[{$config.name}]" class='layui-select'>
                    {volist name=":parse_config_attr($config['extra'])" id="vo"}
                        <option value="{$key}" {eq name="config.value" value="$key"} selected{/eq}>{$vo}</option>
                    {/volist}
                </select>
                {/case}
                {/switch}
                {notempty name="config.remark"}
                <p class="help-block">（{$config.remark}）</p>
                {/notempty}
            </div>


        </div>
        {/volist}
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <button data-target-submit class="layui-btn">保存数据</button>
        <button data-target-backup class="layui-btn layui-btn-danger" type="button">取消编辑</button>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function (){
        $.menu.highlight_subnav("{:url('config/group')}")
    });
    require(["jquery"],function ($) {
        $('#ConfigTable').vali(function (form) {
            $.form.load('{:url()}', form, 'post');
        });
    });
</script>
{/block}
{block name="style"}
<style>
   body a{
       color:#333;
   }
</style>
{/block}